SOCKETS.DATAGRAM_HANDLER Function
The SOCKETS object is deprecated and may be removed in a future release. Use INET::Socket instead.
Syntax
Port_Assigned as N = Datagram_Handler(C Name,N tcp_port,C match,C code)
Arguments
- Port_Assigned
The port that Windows assigned.
- Name
The name to assign to the handler.
- tcp_port
Always set to 0.
- match
The data to watch for in the message stream.
- code
The code to execute.
Description
Setup an named asynchronous handler - when input matches the 'match string' , the code will be invoked with the incoming string in a_message.
Discussion
DATAGRAMS are a lightweight, asynchronous form of sockets communication that Windows supports. The .DATAGRAM_HANDLER() method sets up a named asynchronous handler. When the content in a message matches the Match string, the Code will be invoked.
Example
dim p as N p = Sockets.datagram_handler("foo", 0, "*" + crlf(), <<%code% on error goto error a_result = ""+eval(a_message)+crlf()+"Ok" stop error: a_result = ""+crlf()+"Ok" %code%) ? p = 4557.000000
See Also